IBM Support

PM52657: An error marker is displayed in the Page Designer or JSP Editor for 'onSubmit=return myMethod();' syntax embedded in HTML

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • Abstract:
    
    Using JavaScript in the onSubmit method that starts with the
    keyword 'return' is legal HTML syntax; However, it will be
    marked with the error 'Cannot return from outside a function or
    method' by the client-side JavaScript validator.
    
    Problem:
    
    To reproduce this problem,
    
    1. Right-click WEB-INF ? New ? Web Page
    2. Select the HTML/XHTML template and provide a file name
    3. Finish
    4. Add ?form??/form? tags inside the ?body? section with an
    onSubmit Javascript method as per below:
    
    ?form name='formName' method='post' onSubmit='return
    myMethod();'??/form?
    
    5. Notice that a red line is drawn under the 'return' part in
    quotation marks after you save and rebuild.
    
    6. Remove the 'return' part of the string and resave as per
    below:
    
    ?form name='formName' method='post'
    onSubmit='myMethod();'??/form?
    
    7. Notice that the error is no longer displayed.
    
    Local fix:
    
    The error will not be displayed if the client-side JavaScript
    validator is disabled.
    
    [Window] -? [Preferences] -? [Validation] -?
    Uncheck both [Manual] and [Build] for 'Client-side JavaScript'
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    For web pages, the JavaScript content was determined by
    simply ignoring the HTML sections and performing the
    JavaScript features using the result, in this case
    validation.  The JavaScript content from the example
    resulted in a return statement located outside of a
    function, hence the validation message.
    

Problem conclusion

  • The determination of the JavaScript content has been
    enhanced to support this scenario.  The fix for this APAR is
    included in Rational Application Developer v8.0.4.1.
    

Temporary fix

Comments

APAR Information

  • APAR number

    PM52657

  • Reported component name

    RATL APP DEV SE

  • Reported component ID

    5725B4400

  • Reported release

    803

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2011-11-21

  • Closed date

    2012-05-15

  • Last modified date

    2012-05-15

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    RATL APP DEV SE

  • Fixed component ID

    5725B4400

Applicable component levels

  • R803 PSN

       UP

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSJVRK","label":"Rational Application Developer Standard Edition for WebSphere Software"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"8.0.3","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
15 May 2012